//
//  TZdetailCell.m
//  XMLYFM
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 zzl. All rights reserved.
//

#import "TZdetailCell.h"
#import <Masonry.h>
#import <UIImageView+WebCache.h>
@implementation TZdetailCell

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self creatSubViews];
        
    }
    
    return self;
    

}
-(void)creatSubViews
{
    self.headImageView = [[UIImageView alloc]init];
    self.headImageView.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.headImageView];
    
    [self.headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake((TZWIDTH-40)/3, TZWIDTH *0.5 - 45));
        
        
    }];

    self.picLabel = [[UILabel alloc]init];
//    self.picLabel.backgroundColor = [UIColor grayColor];
    
    self.picLabel.font = [UIFont italicSystemFontOfSize:15];
    self.picLabel.textColor = [UIColor whiteColor];
    [self.headImageView addSubview:self.picLabel];
    
    [self.picLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.headImageView.mas_left);
        make.width.equalTo(self.headImageView.mas_width);
        make.bottom.equalTo(self.headImageView.mas_bottom);
        make.size.height.mas_equalTo(20);
    }];
    
    self.titleLabel = [[UILabel alloc]init];
//    self.titleLabel.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.font = [UIFont italicSystemFontOfSize:15];
//    self.titleLabel.textColor = [UIColor whiteColor];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.headImageView.mas_bottom);
        make.left.equalTo(self.headImageView.mas_left);
        make.width.equalTo(self.headImageView.mas_width);
        make.bottom.equalTo(self.headImageView.mas_bottom).offset(40);
        
      }];
    
}

-(void)setModel:(TZeditorModel *)Model
{

    NSString *imgstr = Model.coverLarge;
    NSURL *imgUrl = [NSURL URLWithString:imgstr];
    [self.headImageView sd_setImageWithURL:imgUrl placeholderImage:nil];
    
    self.picLabel.text = Model.title;
    self.titleLabel.text = Model.trackTitle;


}
@end
